home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / public / ghostscript / showchar.ps < prev    next >
Text File  |  1994-08-01  |  3KB  |  89 lines

  1. %    Copyright (C) 1993 Aladdin Enterprises.  All rights reserved.
  2. %
  3. % This file is part of Ghostscript.
  4. %
  5. % Ghostscript is distributed in the hope that it will be useful, but
  6. % WITHOUT ANY WARRANTY.  No author or distributor accepts responsibility
  7. % to anyone for the consequences of using it or for whether it serves any
  8. % particular purpose or works at all, unless he says so in writing.  Refer
  9. % to the Ghostscript General Public License for full details.
  10. %
  11. % Everyone is granted permission to copy, modify and redistribute
  12. % Ghostscript, but only under the conditions described in the Ghostscript
  13. % General Public License.  A copy of this license is supposed to have been
  14. % given to you along with Ghostscript so you can know your rights and
  15. % responsibilities.  It should be in a file named COPYING.  Among other
  16. % things, the copyright notice and this notice must be preserved on all
  17. % copies.
  18.  
  19. % showchar.ps
  20. % Show the outline and rasterized forms of a character.
  21.  
  22. /F /Palatino-Roman def
  23. /P 8 def
  24. /Rx 360 def
  25. /Ry 360 def
  26. /Cs (T) def
  27. /Delay 0 def
  28.  
  29. 0 setgray
  30. (markpath.ps) run
  31. /mmx [1 0 0 1 0 0] def
  32. /getpath        % - getpath <pathproc>
  33.  { [
  34.     { /moveto cvx } { /lineto cvx } { /curveto cvx } { /closepath cvx }
  35.    pathforall
  36.    ] cvx
  37.  } def
  38. /bitselectfont        % <fontname> <scale> bitselectfont -
  39.  { exch findfont exch scalefont setfont
  40.     % Compute the bounding box in device coordinates.
  41.    gsave [Rx 72 div 0 0 Ry 72 div 0 0] setmatrix
  42.    currentfont /FontMatrix get concat
  43.    currentfont /FontBBox get aload pop
  44.    transform ceiling cvi /ury exch def ceiling cvi /urx exch def
  45.    transform floor cvi /lly exch def floor cvi /llx exch def
  46.    /bbx urx llx sub def /bby ury lly sub def
  47.    grestore
  48.  } def
  49. /bitshow        % <string> bitshow -
  50.  { /S exch def gsave
  51.    /W bbx 8 add 7 or 1 add def
  52.    /H bby 8 add def
  53.    /buf W 8 idiv string def
  54.    /M [Rx 72 div 0 0 Ry -72 div 4 llx sub H 4 sub] def
  55.    M W H <ff 00> makeimagedevice
  56.    /dev exch def
  57.    gsave dev setdevice
  58.    newpath 0 lly idtransform moveto
  59.    0 setgray
  60.    gsave
  61.      /hpath S false charpath getpath def
  62.    grestore
  63.    gsave 0.0001 rotate
  64.      /npath S false charpath getpath def
  65.    grestore
  66.    S show grestore
  67.    20 20 translate
  68.    150000 Rx Ry max P mul div dup scale
  69.    0.7 setgray
  70.    0 W H true M
  71.     { dup 1 add exch dev exch buf copyscanlines
  72.     } imagemask pop
  73.    0 setlinewidth
  74.    gsave 0 setgray hpath exec mmx markpath grestore
  75.    1 0 0 setrgbcolor hpath exec stroke
  76.    gsave 0 setgray npath exec mmx markpath grestore
  77.    0 1 0 setrgbcolor npath exec stroke
  78.  } def
  79. F P bitselectfont
  80. /S1 1 string def
  81. Cs
  82.  { /C exch def
  83.    currentfont /Encoding get C get /.notdef ne
  84.     { save S1 0 C put S1 bitshow
  85.       showpage restore
  86.     } if
  87.  } forall
  88. quit
  89.